home *** CD-ROM | disk | FTP | other *** search
/ Delphi Developer's Kit 1996 / Delphi Developer's Kit 1996.iso / power / source8 / uscroll.pas < prev    next >
Pascal/Delphi Source File  |  1995-12-22  |  5KB  |  159 lines

  1. unit Uscroll;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons, TMulti, Spin;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     BitBtn1: TBitBtn;
  12.     BitBtn2: TBitBtn;
  13.     SaveDialog1: TSaveDialog;
  14.     BitBtn3: TBitBtn;
  15.     BitBtn4: TBitBtn;
  16.     OpenDialog1: TOpenDialog;
  17.     MultiImage1: TMultiImage;
  18.     BitBtn5: TBitBtn;
  19.     MultiImage2: TMultiImage;
  20.     BitBtn6: TBitBtn;
  21.     MultiImage3: TMultiImage;
  22.     ScrollBar1: TScrollBar;
  23.     procedure BitBtn1Click(Sender: TObject);
  24.     procedure BitBtn2Click(Sender: TObject);
  25.     procedure BitBtn3Click(Sender: TObject);
  26.     procedure BitBtn4Click(Sender: TObject);
  27.     procedure BitBtn5Click(Sender: TObject);
  28.     procedure FormCreate(Sender: TObject);
  29.     procedure BitBtn6Click(Sender: TObject);
  30.     procedure ScrollBar1Change(Sender: TObject);
  31.   private
  32.     { Private declarations }
  33.     Procedure Trigger(Sender : TObject; Var Done : Boolean);
  34.   public
  35.     { Public declarations }
  36.   end;
  37.  
  38. var
  39.   Form1: TForm1;
  40.  
  41. implementation
  42.  
  43. {$R *.DFM}
  44.  
  45. procedure TForm1.BitBtn1Click(Sender: TObject);
  46. begin
  47. {load an image or message at MultiImage1 (Top one)}
  48.   Opendialog1.Filename:='*.scm';
  49.   if Opendialog1.execute then
  50.     MultiImage1.ImageName:=Opendialog1.Filename;
  51. end;
  52.  
  53. procedure TForm1.BitBtn2Click(Sender: TObject);
  54. var
  55.   RunAfterCreate : Boolean;
  56. begin
  57.     {Create a new message using the message editor}
  58.     {boolean indicating to run the message after creation}
  59.     RunAfterCreate:=True;
  60.     {CreateMessage takes a pathname as the initial path to save the message
  61.     and a boolean to run it}
  62.     {MultiImage1.CreateMessage('c:\',true);}
  63.     MultiImage1.CreateMessage(ExtractFilePath(Application.Exename),RunAfterCreate);
  64. end;
  65.  
  66. procedure TForm1.BitBtn3Click(Sender: TObject);
  67. begin
  68.    {create a message on the fly at MultiImage1 (Top one)}
  69.    {set Message text}
  70.     MultiImage1.MsgText:='ImageLib 2.1  A great tool to create a superb application in no time.';
  71.     {set Message font name;  Note you could do this also with a font dialog}
  72.     MultiImage1.MsgFont.Name:='Arial';
  73.    {set Message font size}
  74.     MultiImage1.MsgFont.Size:=-40;
  75.     {set Message font style}
  76.     MultiImage1.MsgFont.Style:=[fsitalic, fsbold];
  77.     {set Message font color}
  78.     MultiImage1.MsgFont.Color:=clWhite;
  79.     {set Message background. Note you could do this also with a color dialog}
  80.     MultiImage1.MsgBkGrnd:=clNavy;
  81.     {set Message speed from 1 is fast to 10 is slow}
  82.     MultiImage1.MsgSpeed:=1;
  83.     {inititiate new message}
  84.     MultiImage1.NewMessage;
  85. end;
  86.  
  87. procedure TForm1.BitBtn4Click(Sender: TObject);
  88. begin
  89. {Save current message from  MultiImage1 to a file (Top one)}
  90.  if SaveDialog1.Execute then
  91.   MultiImage1.SaveCurrentMessage(SaveDialog1.FileName);
  92. end;
  93.  
  94. procedure TForm1.BitBtn5Click(Sender: TObject);
  95. begin
  96.   {FreeMsg disposes the picture (message}
  97.   MultiImage1.FreeMsg;
  98. end;
  99.  
  100. procedure TForm1.FormCreate(Sender: TObject);
  101. begin
  102.    {create a message at creation at MultiImage2 (Bottom one)}
  103.    {set Message text}
  104.      MultiImage2.MsgText:='This form contains 3 TMultiImage Components and can display '+
  105.     'Scm, Jpeg, Gif, Pcx, Bmp, Wmf or Ico images. Check out the blob version called '+
  106.     'TDBMultImage or TDBMultMedia to add all the above and AVI, MOV, MID, RMI and WAV '+
  107.     'to a DBase or Paradox TBlobfield';
  108.     {set Message font name;  Note you could do this also with a font dialog}
  109.     MultiImage2.MsgFont.Name:='Arial';
  110.    {set Message font size}
  111.     MultiImage2.MsgFont.Size:=-19;
  112.     {set Message font style}
  113.     MultiImage2.MsgFont.Style:=[fsitalic, fsbold];
  114.     {set Message font color}
  115.     MultiImage2.MsgFont.Color:=clYellow;
  116.     {set Message background. Note you could do this also with a color dialog}
  117.     MultiImage2.MsgBkGrnd:=clBlack;
  118.     {set Message speed from 1 is fast to 10 is slow}
  119.     MultiImage2.MsgSpeed:=5;
  120.     {inititiate new message}
  121.     MultiImage2.NewMessage;
  122.  
  123.     {IMPORTANT}
  124.     {This is the moving engine for all the messages. Since an applcation
  125.     can have only one OnIdle Trigger, this trigger needs to be subdivided
  126.     by all your moving and animated objects. In this particular case the
  127.     function is called TRIGGER but you can name it as you want as long
  128.     you have a procedure named the same.}
  129.  
  130.     Application.OnIdle:=Trigger;
  131. end;
  132.  
  133. Procedure TForm1.Trigger(Sender : TObject; Var Done : Boolean);
  134. begin
  135.    {This function is called when your app is idle. Subdivide the
  136.     trigger event to your TMultiImage objects who may need one.
  137.     If no Message is active it will not take up significant time}
  138.     MultiImage3.Trigger;
  139.     MultiImage2.Trigger;
  140.     MultiImage1.Trigger;
  141. end;
  142.  
  143. procedure TForm1.BitBtn6Click(Sender: TObject);
  144. begin
  145. {load an image or message at MultiImage3 (Middle one)}
  146.   Opendialog1.Filename:='*.jpg';
  147.   if Opendialog1.execute then
  148.     MultiImage3.ImageName:=Opendialog1.Filename;
  149. end;
  150.  
  151. procedure TForm1.ScrollBar1Change(Sender: TObject);
  152. begin
  153.  {change the speed of the bottom message}
  154.  MultiImage2.MsgSpeed:=ScrollBar1.Position;
  155. end;
  156.  
  157.  
  158. end.
  159.